package April._30.homework.work2;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<User> users = new ArrayList<>();
        users.add(new User("zs", 20, 66));
        users.add(new User("ls", 21, 88));
        users.add(new User("ww", 16, 99));
        users.add(new User("zs", 20, 66));
        users.add(new User("sq", 25, 55));

        delDouble(users);
        System.out.println("users = " + users);
    }

    public static void delDouble(List users){
        List<User> users1 = new ArrayList<>();
        Iterator iterator = users.iterator();
        while (iterator.hasNext()){
            User next = (User) iterator.next();
            if(!users1.contains(next)){
                users1.add(next);
            }else {
                users.remove(next);
            }
        }
    }
}
